package com.nextbusmn.server.JSONBuilders;

import com.google.appengine.labs.repackaged.org.json.JSONException;
import com.google.appengine.labs.repackaged.org.json.JSONObject;
import com.nextbusmn.server.dataobjects.BusStopData;

public class SingleStopJSONBuilder {
	
	public static JSONObject getSingleStopJSON(BusStopData stopData) {
		
		JSONObject obj = new JSONObject();
		try {
			obj.put("n", stopData.getStopName());
			obj.put("d", stopData.getStopDesc());
			obj.put("x", (int) Math.floor(stopData.getStopLon() * 1000000.0));
			obj.put("y", (int) Math.floor(stopData.getStopLat() * 1000000.0));
		} catch (JSONException e) {
			e.printStackTrace();
		}
		
		return obj;
	}
}
